package com.chinasoft.server.mapper;

import com.chinasoft.server.pojo.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BrandMapper {

    @Select("select * from tb_brand where id = #{id}")  //
    Brand selectById(Integer id);

    @Select("select * from tb_brand ")
    List<Brand> selectAll();

    // 删除
    @Delete("delete from tb_brand where id = #{id}")
    Integer delete(Integer id);

    // 新增一条记录
    @Insert("insert into tb_brand values(null, #{brandName}, #{companyName}, " +
            " #{ordered}, #{description}, #{status})")
    Integer insert(Brand brand);

    // 修改记录
    @Update("update tb_brand set brand_name = #{brandName}, " +
            " company_name = #{companyName}, " +
            " ordered = #{ordered}, " +
            " description = #{description}, " +
            " status = #{status} " +
            " where id = #{id}")
    Integer update(Brand brand);
}
